<?php
namespace app\index\controller;
class Index extends Base {
	//个人资料
	public function index() {
		exit();
	}
	public function addevas() {
		$this->assign('id', $this->postData['id']);
		return $this->fetch();
	}
	public function yuyue() {
		$requiresid = $this->postData['requiresid'];
		$receive_uid = $this->postData['receive_uid'];
		$nums = model("Pickorder")->where('userid', $this->uinfo['id'])->whereTime('addtime', 'today')->count();
		$margin_ok = 1;
		$requiresinfo = model('Requires')->get_data(['item_id' => $requiresid]);
		if ($requiresinfo['price'] <= config('REQUIRES_MARGIN_MAX')) {
			$mtinfo = model('MarginTicket')->where('userid', $this->uinfo['id'])->find();
			if (empty($mtinfo) || $mtinfo['status'] == 1) {
				if ($requiresinfo['price'] * config('REQUIRES_MARGIN_BILI') / 100 > $this->uinfo['margin']) {
					$margin_ok = 0;
				}
			}
		} else {
			if ($requiresinfo['price'] * config('REQUIRES_MARGIN_BILI') / 100 > $this->uinfo['margin']) {
				$margin_ok = 0;
			}
		}
		trace($margin_ok);
		$this->assign('nums', $nums);
		$this->assign('margin_ok', $margin_ok);
		$this->assign('requiresid', $requiresid);
		$this->assign('receive_uid', $receive_uid);
		return $this->fetch();
	}
	public function setting() {

		$this->assign('title', '设置');
		return $this->fetch();
	}
	// 优惠券详情
	public function yhq_detail() {
		$id = $this->postData['id'];
		$couponsinfo = model('MemberCoupons')->where('id', $id)->find();
		$this->assign('title', '会员权益');
		$this->assign('info', $couponsinfo);
		return $this->fetch();
	}
	public function loading() {
		$url = '';
		if ($this->postData['kind'] == 1) {
			$url = 'https://www.skoda.com.cn';
		}
		$this->assign('url', $url);
		$this->assign('title', '汽车信息');
		return $this->fetch();
	}
	public function formwork1() {

		return $this->fetch('formwork1/index');
	}
}